if __name__ == '__main__':

    # P86---文件读取(文件地址，模式，编码)
    try:
        f = open("D:/ccc.txt","r",encoding="utf-8")
        print(f.read())
        # print(f.readline())
        # print(f.readlines())
        f.close()
    except FileNotFoundError as fe:
        pass
    except Exception as e:
        pass
    except:
        pass
    else:
        # 如果没有异常的情况会走这里
        pass
    finally:
        # 无论如何都会执行这里
        pass
    # with open("D:/ccc.txt","r",encoding="utf-8") as f:
    #     for line in f:
    #         print(line,end="")


    # P88---文件写出
    # f = open("D:/ccc.txt", "w")
    # f.write("hello world")
    # f.flush()
    # f.close()

    # P89---文件追加写出
    # f = open("D:/ccc.txt", "a")
    # f.write("\n")
    # f.write("你好")
    # f.flush()
    # f.close()